﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace CapSample
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCap(x =>
            {
                x.UseDashboard();
                x.DefaultGroup = "defaultGroupName";
                //x.UseMySql("server=121.46.130.92;database=verticalsitedb;port=3306;uid=root;pwd=p@ssw0rd;");
                x.UseMySql("server=140.143.88.100;database=verticalsitedb;port=3306;uid=root;pwd=p@ssw0rd;");
                x.UseRabbitMQ(opt =>
                {
                    opt.HostName = "121.46.130.92";
                    opt.Password = "p@ssw0rd";
                    opt.UserName = "admin";
                });
            });
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseMvc();
        }
    }
}
